package com.hengby.hengcrud.core.exception;

/**
 * @author zhouheng
 */

public enum HengCrudExceptionEnum implements ServiceExceptionEnum{
    /**
     * 其他
     */
    WRITE_ERROR(500,"渲染界面错误"),

    /**
     * 字典
     */
    DICT_EXISTED(400,"字典已经存在"),
    ERROR_CREATE_DICT(500,"创建字典失败"),
    ERROR_WRAPPER_FIELD(500,"包装字典属性失败"),
    ERROR_WRAPPER_METHOD_NOTFOUND(500,"包装字典方法找不到"),

    /**
     * 文件上传
     */
    FILE_READING_ERROR(400,"FILE_READING_ERROR!"),
    FILE_NOT_FOUND(404,"FILE_NOT_FOUND!"),
    UPLOAD_ERROR(500,"上传图片出错"),
    FILE_UPLOAD_ERROR(500,"文件上传失败"),
    FILE_IS_EMPTY(500,"文件上传为空"),
    FILE_READ_ERROR(500,"文件读取失败"),

    /**
     * 权限和数据问题
     */
    DB_RESOURCE_NULL(400,"数据库中没有该资源"),
    NO_PERMITION(405, "权限异常"),
    REQUEST_INVALIDATE(400,"请求数据格式不正确"),
    INVALID_KAPTCHA(400,"验证码不正确"),
    CANT_DELETE_ADMIN(600,"不能删除超级管理员"),
    CANT_FREEZE_ADMIN(600,"不能冻结超级管理员"),
    CANT_CHANGE_ADMIN(600,"不能修改超级管理员角色"),

    /**
     * 账户问题
     */
    USER_ALREADY_REG(401,"该用户已经注册"),
    NO_THIS_USER(400,"没有此用户"),
    USER_NOT_EXISTED(400, "没有此用户"),
    ACCOUNT_FREEZED(401, "账号被冻结"),
    OLD_PWD_NOT_RIGHT(402, "原密码不正确"),
    TWO_PWD_NOT_MATCH(405, "两次输入密码不一致"),

    /**
     * job
     */
    JOB_ADD_ERROR(500,"添加任务异常"),
    RUN_JOB_ERROR(500,"执行任务失败"),


    /**
     * 错误的请求
     */
    MENU_PCODE_COINCIDENCE(400,"菜单编号和副编号不能一致"),
    EXISTED_THE_MENU(400,"菜单编号重复，不能添加"),
    DICT_MUST_BE_NUMBER(400,"字典的值必须为数字"),
    REQUEST_NULL(400, "请求有错误"),
    SESSION_TIMEOUT(400, "会话超时"),
    SERVER_ERROR(500, "服务器异常"),


    /**
     * excel导出异常
     */
    EXPORT_EXCEL_ERROR(500,"导出Excel失败"),
    EXPORT_CSV_ERROR(500,"导出csv失败"),
    EXPORT_DATA_IS_EMPTY(500, "导出数据异常"),

    /**
     * 邮件发送
     */
    SEND_EMAIL_ERROR(500, "发送邮件失败");

    public Integer code;
    public String message;


    HengCrudExceptionEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return null;
    }

    @Override
    public String getMessage() {
        return null;
    }
}
